package com.space.user.converter;

import com.space.user.database.dataobject.UserInfoDO;
import com.space.user.domain.info.entity.UserInfo;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * @author <a href="mailto:414563035@qq.com">Bedroom</a>
 * @date 2021/4/23 2:53 下午
 */
@Mapper(config = ShareMapperConfig.class)
public interface UserInfoConverter {
    @Mappings({
            @Mapping(source = "userId", target = "userId.userId"),
            @Mapping(source = "phoneNumber", target = "phoneNumber.phoneNumber"),
            @Mapping(source = "nickname", target = "nickname.nickname"),
    })
    UserInfo toEntity(UserInfoDO userInfoDO);

    @InheritInverseConfiguration
    UserInfoDO toDO(UserInfo userInfoDO);
}
